home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / calculator.pprx < prev    next >
Text File  |  1992-03-14  |  946b  |  44 lines

  1. /*
  2. @BCalculator  @P@ICopyright Gold Disk Inc., February, 1992
  3.  
  4. This Genie allows you to evaluate one-line mathematical expressions.
  5. */
  6. if ~show(l, "gdarexxsupport.library") then
  7.    if ~addlib("gdarexxsupport.library", 0, -30) then
  8.       exit_msg("Please install the gdarexxsupport.library in your Libs: directory before running this Genie!")
  9. signal on error
  10. signal on syntax
  11.  
  12. call ppm_AutoUpdate(0)
  13.  
  14. defvalue    = getclip(ppm_calval)
  15. cr = pos('0a'x,defvalue)
  16. if cr ~= 0 then defvalue = left(defvalue,cr-1)
  17. command = ppm_GetForm("Enter Calculation",40, "Expression =:"defvalue)
  18. if command = '' then exit_msg()
  19.  
  20. interpret "returnval = "command
  21. call setclip(ppm_calval, returnval)
  22.  
  23. call exit_msg(command" = "returnval)
  24.  
  25. error:
  26. syntax:
  27. do
  28.     if rc = 16 then exit_msg()
  29.     exit_msg(command ": "errortext(rc))
  30.  
  31. end
  32.  
  33.  
  34. exit_msg:
  35. do
  36.     parse arg message
  37.  
  38.     if message ~= '' then call ppm_Inform(1, message,)
  39.     call ppm_AutoUpdate(1)
  40.     exit
  41. end
  42.  
  43.  
  44.